package com.bootdo.appsystem.service.impl;

import com.bootdo.appsystem.domain.OrderproductDO;
import com.bootdo.appsystem.domain.SellerDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.bootdo.appsystem.dao.MessageDao;
import com.bootdo.appsystem.domain.MessageDO;
import com.bootdo.appsystem.service.MessageService;



@Service
public class MessageServiceImpl implements MessageService {
	@Autowired
	private MessageDao messageDao;
	
	@Override
	public MessageDO get(Integer msgid){
		return messageDao.get(msgid);
	}
	
	@Override
	public List<MessageDO> list(Map<String, Object> map){
		return messageDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return messageDao.count(map);
	}
	
	@Override
	public int save(MessageDO message){
		return messageDao.save(message);
	}
	
	@Override
	public int update(MessageDO message){
		return messageDao.update(message);
	}
	
	@Override
	public int remove(Integer msgid){
		return messageDao.remove(msgid);
	}
	
	@Override
	public int batchRemove(Integer[] msgids){
		return messageDao.batchRemove(msgids);
	}

	@Override
	public void faGoodsOrderSellerMessage(OrderproductDO orderproductDO, SellerDO sellerDO) {
        MessageDO messageDO = new MessageDO();
        messageDO.setAddtime(new Date());
        messageDO.setUid(sellerDO.getUid());
        messageDO.setIsread(0);
        messageDO.setCustomername("系统消息：订单信息");
        messageDO.setIntro("有新的商品订单，请尽快查看");
        messageDO.setIstop(1);
        messageDO.setContent("<h1>您好</h1><p>您的订单：</p><p>订单号:"+orderproductDO.getOrdercode()+"" +
                "</p><p>已经支付成功！</p><p>请注意查看，尽早发货！</p>");
        messageDO.setTitle("新订单消息");
        this.save(messageDO);
    }

}
